package com.zhouyang.imtest.entity;


import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;


import java.util.Date;

/**
 * @Author:ZhouYang
 * @Description:
 * @Date: Created in 2020/7/16 9:57
 * @Modified By：
 *
 *
 * 注解描述：
 * @Indexed   自动创建索引
 * @Document  指定mongoDB表名称映射
 * @Field     指定字段映射
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "message")//指定mongoDB表名称映射
@Builder
public class Message {



    @Id
    private ObjectId id;

    private String msg;
    /*** 消息状态，1-未读，2-已读 */
    @Indexed
    private Integer status;
    @Field("send_date")
    @Indexed
    private Date sendDate;
    @Field("read_date")//指定mongoDB字段名称映射
    private Date readDate;
    @Indexed
    private User from;
    @Indexed
    private User to;
}
